#pragma once
#include "Lib.h"

struct ClassInfo
{
	jint ClassID;
	const char* Signature;
	const char* SourceFileName;
};

// return value indicate whether to supress the nested call (like wait in join).
typedef bool (*callbackMethod)(jthread thread, jint threadHash, jobject instance, jint instanceHash);

struct MethodInfo
{
	jmethodID MethodID;
	const char* Name;
	const char* Signature;
	const char* ClassSignature;

	callbackMethod CallbackEntry;
	callbackMethod CallbackExit;
};

struct InterestMethodTableEntry
{
	const char* Name;
	const char* Signature;
	const char* ClassSignature;
	callbackMethod CallbackEntry;
	callbackMethod CallbackExit;
};

// methodID cache
MethodInfo* GetCachedMethodInfo(jmethodID method);
bool TryAddCacheMethodInfo(jmethodID method, InterestMethodTableEntry* list);

// classSignature cache
bool CheckCachedClassInfo(jint classHash);

// method SourceMap table
bool CheckCachedMethodSourceInfo(jmethodID method);
